
#include "BSP.h"

#include "rfid_interface.h"
#include "id_card.h"
#include "AvgFilter.h"

#include "HIDProx.h"

void indala_data_decode(uint16_t *value, uint32_t len);


static uint8_t support_tag = RFID_ITF_TAG_ID | RFID_ITF_TAG_HID;

void rfid_itf_set_tag(uint8_t tag)
{
	support_tag |= tag;
}

void rfid_itf_clr_tag(uint8_t tag)
{
	support_tag &= ~tag;
}

uint8_t rfid_itf_read_flag(void){
	return support_tag;
}

void rfid_itf_write_flag(uint8_t tag){
	support_tag = tag;
}

#if 0
void rfid_itf_decode(uint16_t *adc_value, uint32_t len)
{
	//滤除杂波
#if RFID_ITF_COLLECT_FREQ > 125000U
	len = AvgFilter_Filtering(adc_value, len);
#endif 
	#if RFID_ITF_ID_CARD_EN
	if(support_tag & RFID_ITF_TAG_ID)
	{
		id_card_data_decode(adc_value, len);
	}
	#endif
	#if RFID_ITF_HID_CARD_EN
	if(support_tag & RFID_ITF_TAG_HID)
	{
		HIDProxDecoder_Input(adc_value, len);
	}
	#endif
}
#else
void rf_data_input_isr(uint16_t *data, uint16_t len);
void rfid_itf_decode(uint16_t *adc_value, uint32_t len)
{
	rf_data_input_isr(adc_value, len);
}
#endif 

uint8_t rfid_itf_support(void){
	return support_tag;
}

